package org.smartloli.kafka.eagle.config;

import lombok.extern.slf4j.Slf4j;
import org.smartloli.kafka.eagle.infra.util.FigletFontUtils;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import java.io.IOException;
import java.io.InputStream;

/**
 * @author zhiwei_yang
 * @time 2020-6-30-10:03
 */
@Component
@Slf4j
public class KafkaEagleConfig implements CommandLineRunner {

    /**
     * 打印提示语
     *
     * @throws IOException
     */
    @Override
    public void run(String... args) throws Exception{
        StringBuilder stringBuilder = new StringBuilder();
        InputStream inputStream = FigletFontUtils.class.getClassLoader().getResourceAsStream("font/slant.flf");
        String asciiArt = FigletFontUtils.convertOneLine(inputStream, "NEW KAfKA EAGLE");
        stringBuilder.append("Welcome to").append("\r\n");
        stringBuilder.append(asciiArt).append("\r\n");
        stringBuilder.append("Version 1.4.6 -- Copyright 2016-2020");
        log.info(stringBuilder.toString());
    }
}